package com.zhang.passer.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhang.passer.domain.ImageDo;
import com.zhang.passer.mapper.ImageMapper;
import com.zhang.passer.mapper.JingMapper;
import com.zhang.passer.mapper.MeishiMapper;
import com.zhang.passer.mapper.YouJiMapper;
import com.zhang.passer.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("img")
public class ImageServiceImpl implements ImageService {

    @Autowired
    private ImageMapper imageMapper;

    @Override
    public List<ImageDo> queryAll(ImageDo imageDo) {
        QueryWrapper<ImageDo> imageDoQueryWrapper = new QueryWrapper<>(imageDo);
        return imageMapper.selectList(imageDoQueryWrapper);
    }


    @Override
    public List<ImageDo> queryBanner5() {
        return imageMapper.selectList(new QueryWrapper<>(new ImageDo().setType("banner")).last("limit 5"));
    }

    @Override
    public List<ImageDo> queryJingdian7() {
        return imageMapper.selectList(new QueryWrapper<>(new ImageDo().setType("jingdian")).last("limit 7"));
    }

    @Override
    public List<ImageDo> queryMeishi2() {
        return imageMapper.selectList(new QueryWrapper<>(new ImageDo().setType("meishi")).last("order by sid desc limit 2"));
    }

}
